import 'package:hi_common/hi_common.dart';

class HourMinute {
  int hour;
  int minute;

  HourMinute(this.hour, this.minute);

  HourMinute.fromString(String time) {
    var temp = time.split(':');
    hour = int.parse(temp[0]);
    minute = int.parse(temp[1]);
  }

  bool isBefore(HourMinute other) {
    if (other.hour < hour) {
      return false;
    }

    if (other.hour == hour && other.minute < minute) {
      return false;
    }

    return true;
  }

  String toString() {
    return '${StringUtil.singlePadLeftZero(hour.toString())}:${StringUtil.singlePadLeftZero(minute.toString())}';
  }
}
